-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[lldb] correct event when removing all watchpoints #125312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lldb] correct event when removing all watchpoints #125312
Conversation
|
@llvm/pr-subscribers-lldb Author: Ben Jackson (puremourning) ChangesPreviously we incorrectly emitted a "breakpoint changed" event when removing all watchpoints (e.g. via SBTarget::DeleteAllWatchpoints()). Correct it to emit the "watchpoint changed" event, as that's what "Remove" does and what it checks for being registered. No test for now. It looks possible to add one though. Full diff: https://github.com/llvm/llvm-project/pull/125312.diff 1 Files Affected:
diff --git a/lldb/source/Breakpoint/WatchpointList.cpp b/lldb/source/Breakpoint/WatchpointList.cpp
index f7564483e6f1fcd..57369b76c03aff0 100644
--- a/lldb/source/Breakpoint/WatchpointList.cpp
+++ b/lldb/source/Breakpoint/WatchpointList.cpp
@@ -236,7 +236,7 @@ void WatchpointList::RemoveAll(bool notify) {
wp_collection::iterator pos, end = m_watchpoints.end();
for (pos = m_watchpoints.begin(); pos != end; ++pos) {
if ((*pos)->GetTarget().EventTypeHasListeners(
- Target::eBroadcastBitBreakpointChanged)) {
+ Target::eBroadcastBitWatchpointChanged)) {
auto data_sp = std::make_shared<Watchpoint::WatchpointEventData>(
eWatchpointEventTypeRemoved, *pos);
(*pos)->GetTarget().BroadcastEvent(
|
c6c6e9b to
0bf7cf4
Compare
|
Can you write or modify a test? I glanced over |
|
Yes, on it. Sorry I should have marked this PR [wip]. |
Previously we incorrectly checked for a "breakpoint changed" event listener removing all watchpoints (e.g. via SBTarget::DeleteAllWatchpoints()), although we would emit a "watchpoint changed" event if there were a listener for 'breakpoint changed'. This meant that we might not emit a "watchpoint changed" event if there was a listener for this event. Correct it to check for the "watchpoint changed" event.
0bf7cf4 to
6af277d
Compare
|
Done. The test fails (expectedly) at the line following "DeleteAllWatchpoints" prior to this patch, and passes after. |
JDevlieghere
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
|
@puremourning Let me know if you need someone to press the Merge button for you. |
Yes please. I don't have commit rights. |
clayborg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this!
LLDB: correct event when removing all watchpoints
Previously we incorrectly checked for a "breakpoint changed" event
listener removing all watchpoints (e.g. via
SBTarget::DeleteAllWatchpoints()), although we would emit a "watchpoint
changed" event if there were a listener for 'breakpoint changed'.
This meant that we might not emit a "watchpoint changed" event if there
was a listener for this event.
Correct it to check for the "watchpoint changed" event.
---
Updated regression tests which were also incorrectly peeking for the
wrong event type. The 'remove' action actually triggers 2 events which
the test didn't allow, so I updated it to allow specifically what was
requested.
The test fails (expectedly) at the line following "DeleteAllWatchpoints"
prior to this patch, and passes after.
Updated regression tests which were also incorrectly peeking for the wrong event type. The 'remove' action actually triggers 2 events which the test didn't allow, so I updated it to allow specifically what was requested.
The test fails (expectedly) at the line following "DeleteAllWatchpoints" prior to this patch, and passes after.